home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / updatePrefWndUI.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  29.8 KB  |  1,111 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Jan 2000
  22. //
  23. //  Description:
  24. //      The procedures in this file are used to update (set the
  25. //        correct values for) the UI controls in the Preferences
  26. //        window.  The updates should be done from the pref
  27. //        optionVars to make the window work correctly after a
  28. //        reset or revert to factory settings.
  29. //
  30. //    Note: If adding preferences, make sure to read
  31. //    http://w3.tor.aw.sgi.com/maya/TechDoc/CodingGuides/addingPreferences.html
  32. //
  33.  
  34. global proc prefsUpdate()
  35. {
  36.     prefsUpdateAppearance();
  37.     prefsUpdateElements();
  38.     prefsUpdateWindows();
  39.     prefsUpdateDisplay();
  40.     prefsUpdateKin();
  41.     prefsUpdateAnimDisplay();
  42.     prefsUpdateManips();
  43.     prefsUpdateNURBS();
  44.     prefsUpdatePolys();
  45.     prefsUpdateSettings();
  46.     prefsUpdateAnim();
  47.     prefsUpdateDyn();
  48.     prefsUpdateKeys();
  49.     prefsUpdateModeling();
  50.     prefsUpdateSelect();
  51.     prefsUpdateSnap();
  52.     prefsUpdateSound();
  53.     prefsUpdateAdvanced();
  54.     prefsUpdateRendering();
  55.     prefsUpdateFileIO();
  56.     prefsUpdateModules();
  57.     prefsUpdateOpenMaya();
  58. }
  59.  
  60. global proc prefsUpdateAppearance()
  61. {
  62.     global string $gPreferenceWindow;
  63.     global string $gMainWindow;
  64.     global string $gCommandWindow;
  65.     global string $gMayaMode;
  66.  
  67.     setParent $gPreferenceWindow;
  68.     string $parent = "prefAppearCol";
  69.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  70.  
  71.     string $prefMode = `optionVar -q mayaMode`;
  72.  
  73.     if ("Animation" == $prefMode) {
  74.         optionMenuGrp -e -sl 1 modeOpts;
  75.     } else if ("Modeling" == $gMayaMode) {
  76.         optionMenuGrp -e -sl 2 modeOpts;
  77.     } else if ("Dynamics" == $gMayaMode) {
  78.         optionMenuGrp -e -sl 3 modeOpts;
  79.     } else if ("Rendering" == $gMayaMode) {
  80.         optionMenuGrp -e -sl 4 modeOpts;
  81.     } else if ("dynamics" == $prefMode) {
  82.         optionMenuGrp -e -sl 5 modeOpts;
  83.     } else if ("rendering" == $prefMode) {
  84.         optionMenuGrp -e -sl 6 modeOpts;
  85.     } else {
  86.         optionMenuGrp -e -sl 1 modeOpts;
  87.     }
  88.         
  89.     checkBoxGrp -e 
  90.         -value1 `optionVar -query mainWindowMenubarVis` 
  91.         mainMenubarCheck1;
  92.  
  93.     checkBoxGrp -e
  94.         -value1 `optionVar -query allowMenusInPanels`
  95.         showMenuBarChk;
  96.  
  97.     checkBoxGrp -e 
  98.         -value1 `optionVar -query mainWindowTitleBarVis` 
  99.         mainTitleCheck1;
  100.  
  101.     checkBoxGrp -e 
  102.         -value1 `optionVar -query cmdWindowTitleBarVis` 
  103.         cmdTitleCheck1;
  104.  
  105.     checkBoxGrp -e 
  106.         -value1 `optionVar -query saveWindowPos` 
  107.         winPrefChk;
  108.  
  109.     checkBoxGrp -e
  110.         -value1 `optionVar -query commandLineHoldFocus` 
  111.         focusCheck;
  112.  
  113.     if( `optionVar -q aeInMainWindow` ) {
  114.         radioButtonGrp -edit -sl 1 aeInWindowPrefChk2;
  115.     } else {
  116.         radioButtonGrp -edit -sl 1 aeInWindowPrefChk1;
  117.     }
  118.  
  119.     if (`optionVar -query toolSettingsInMainWindow`) {
  120.         radioButtonGrp -edit -select 1 toolSettingsInWindowPrefChk2;
  121.     } else {
  122.         radioButtonGrp -edit -select 1 toolSettingsInWindowPrefChk1;
  123.     }
  124.  
  125.     optionMenuGrp -e 
  126.         -sl `optionVar -q EEexprEdTextEditor` 
  127.         textEdOpts;
  128.  
  129.     prefExprEdTextEditor(1);
  130.  
  131.     if( `about -mac` ) {
  132.         radioButtonGrp -e -sl `optionVar -q mayaMacButtonMap` mouseTracking;
  133.     }
  134. }
  135.  
  136.  
  137. global proc prefsUpdateElements() 
  138. {
  139.     global string $gPreferenceWindow;
  140.     setParent $gPreferenceWindow;
  141.     string $parent = "prefElementsCol";
  142.     if (`columnLayout -query -numberOfChildren $parent` == 0) return;
  143.     
  144.     checkBoxGrp -edit
  145.         -value1 `optionVar -query statusLineVisible`
  146.         statusLineCheckBox;
  147.  
  148.     checkBoxGrp -edit
  149.         -value1 `optionVar -query isShelfVisible`
  150.         shelfCheckBox;
  151.  
  152.     checkBoxGrp -edit
  153.         -value1 `optionVar -query timeSliderVisible`
  154.         timeSliderCheckBox;
  155.  
  156.     checkBoxGrp -edit
  157.         -value1 `optionVar -query playbackRangeVisible`
  158.         playbackRangeCheckBox;
  159.         
  160.     checkBoxGrp -edit
  161.         -value1 `optionVar -query commandLineVisible`
  162.         commandLineCheckBox;
  163.  
  164.     checkBoxGrp -edit
  165.         -value1 `optionVar -query helpLineVisible`
  166.         helpLineCheckBox;
  167.  
  168.     checkBoxGrp -edit
  169.         -value1 `optionVar -query toolboxVisible`
  170.         toolboxCheckBox;
  171.  
  172.     checkBoxGrp -edit
  173.         -value1 `optionVar -query isAttributeEditorVisible`
  174.         attributeEditorCheckBox;
  175.  
  176.     checkBoxGrp -edit
  177.         -value1 `optionVar -query toolSettingsVisible`
  178.         toolSettingsCheckBox;
  179.  
  180.     checkBoxGrp -edit
  181.         -value1 `optionVar -query channelsLayersVisible`
  182.         channelsLayersCheckBox;
  183. }
  184.  
  185. global proc prefsUpdateWindows() 
  186. {
  187.     global string $gPreferenceWindow;
  188.     global int    $gRaiseHelpBrowserWin;
  189.     global string $gHelpLanguage;
  190.     global string $gNewScenePanelConfig;
  191.     global int      $gUseNewScenePanelConfig;
  192.     global int      $gUseScenePanelConfig;
  193.     global int      $gUseSaveScenePanelConfig;
  194.  
  195.     setParent $gPreferenceWindow;
  196.     string $parent = "prefWindowsCol";
  197.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  198.  
  199.     //
  200.     // Help
  201.     //
  202.     intFieldGrp -edit
  203.         -value1 `optionVar -query helpPopupDisplayTime` 
  204.         popupHelpTime;
  205.  
  206. // This UI removed in Maya 5.0.
  207. //
  208. //    if (`optionVar -q helpBrowserUseWindow`) {
  209. //        radioButtonGrp -e -sl 1 winRBG;
  210. //    } else {
  211. //        radioButtonGrp -e -sl 1 winRBG2;
  212. //    }
  213. //
  214. //    checkBoxGrp -e 
  215. //        -value1 `optionVar -query helpBrowserRaiseWindow` visCBG;
  216.  
  217. // Functionality removed before Maya 4.0 shipped.
  218. // Needs better integration before being resurrected.
  219. //
  220. //    if (`about -nt`) {
  221. //        if( `optionVar -q helpInMainWindow` ) {
  222. //            radioButtonGrp -edit -sl 1 helpInWindowPrefChk2;
  223. //        } else {
  224. //            radioButtonGrp -edit -sl 1 helpInWindowPrefChk1;
  225. //        }
  226. //    }
  227.  
  228.     string $language = `optionVar -q helpLanguage`;
  229.     if ($language == "en_US") {
  230.         radioButtonGrp -e -select 1 helpLanguageEnglish;
  231.         textFieldGrp -e -enable false helpLanguageSpecify;
  232.     } else if ($language == "ja_JP"){
  233.         radioButtonGrp -e -select 1 helpLanguageJapanese;
  234.         textFieldGrp -e -enable false helpLanguageSpecify;
  235.     } else {
  236.         radioButtonGrp -e -select 1 helpLanguageOther;
  237.         textFieldGrp -e -enable true helpLanguageSpecify;
  238.     }
  239.  
  240.     textFieldGrp -edit
  241.         -text `optionVar -q helpLanguage`
  242.         helpLanguageSpecify;
  243.  
  244.     // If MAYA_HELP_URL env var is set, we won't allow
  245.     // this to be set from the UI
  246.     string $envVar = `getenv MAYA_HELP_URL`;
  247.     if ( size($envVar) > 0 ) {
  248.         radioButtonGrp -edit -enable false helpLocationLocal;
  249.         radioButtonGrp -edit -enable false helpLocationRemote;
  250.         textFieldGrp -edit -text $envVar -enable false helpUrlField;
  251.     } else {
  252.         string $location = `optionVar -q helpUrl`;
  253.         if (size($location) == 0) {
  254.             radioButtonGrp -e -select 1 helpLocationLocal;
  255.             textFieldGrp -e -enable false helpUrlField;
  256.         } else {
  257.             radioButtonGrp -e -select 1 helpLocationRemote;
  258.             textFieldGrp -e -enable true helpUrlField;
  259.         }
  260.         textFieldGrp -edit -text `optionVar -q remoteHelpUrl` helpUrlField;
  261.     }
  262.  
  263.     //
  264.     // Scene config
  265.     //
  266.     int    $i, $nItems, $nConfigs;
  267.     int    $count = 0;
  268.     string $currSelect, $config;
  269.     string $configs[] = `getPanel -allConfigs`;
  270.     string $items[];
  271.  
  272.     //
  273.     //  update menu items.
  274.     //
  275.  
  276.     // This is a fix to get around the optionMenuGrp bug (#81337)
  277.     string $fullName = `setParent "configOpts"`;
  278.     string $menuName = ($fullName+"|OptionMenu");
  279.     setParent -m $menuName;
  280.  
  281.     $currSelect = $gNewScenePanelConfig;
  282.     $configs = `getPanel -allConfigs`;
  283.     $nConfigs = size($configs);
  284.     $items = `optionMenuGrp -q -ill configOpts`;
  285.     $nItems = `optionMenuGrp -q -ni configOpts`;
  286.     $count = 0;
  287.     for ($i = 0; $i < $nConfigs; $i++) {
  288.         if (!`panelConfiguration -q -sc $configs[$i]` &&
  289.         "Current Layout" != `panelConfiguration -q -l $configs[$i]`) 
  290.         {
  291.             if ($count < $nItems) {
  292.                 menuItem -e -l `panelConfiguration -q -l $configs[$i]` $items[$count];
  293.             } else {
  294.                 menuItem -l `panelConfiguration -q -l $configs[$i]`;
  295.             }
  296.             $count++;
  297.         }
  298.     }
  299.     //  remove any extra items
  300.     for ($i = $count; $i < $nItems; $i++) {
  301.         deleteUI -menuItem $items[$i];
  302.     }
  303.  
  304.     checkBoxGrp -edit
  305.         -value1 `optionVar -query useSaveScenePanelConfig`
  306.         saveConfig;
  307.  
  308.     checkBoxGrp -edit
  309.         -value1 `optionVar -query useScenePanelConfig`
  310.         openConfig;
  311.  
  312.     if (`optionVar -q "useNewScenePanelConfig"`) {
  313.         radioButtonGrp -e -sl 1 newConfig2;
  314.     } else {
  315.         radioButtonGrp -e -sl 1 newConfig1;
  316.     }
  317.  
  318.     $count = 0;
  319.     $currSelect = `optionVar -q "newScenePanelConfiguration"`;
  320.     for ($config in $configs) {
  321.         if (!`panelConfiguration -q -sc $config` &&
  322.         "Current Layout" != `panelConfiguration -q -l $config`) 
  323.         {
  324.             $count++;
  325.             if ($currSelect == `panelConfiguration -q -l $config`) {
  326.                 optionMenuGrp -e -sl $count configOpts;
  327.                 break;
  328.             }
  329.         }
  330.     }
  331. }
  332.  
  333. global proc prefsUpdateDisplay() 
  334. {
  335.     global string $gPreferenceWindow;
  336.     setParent $gPreferenceWindow;
  337.     string $parent = "prefDisplayCol";
  338.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  339.  
  340.     radioButtonGrp -e 
  341.         -sl (`optionVar -q fastInteraction` ? 1 : 2) fastRBG;
  342.  
  343.     checkBoxGrp -edit
  344.         -value1 `optionVar -query viewAxisVisibility` axisCBG;
  345.     checkBoxGrp -edit
  346.         -value2 `optionVar -query toggleOriginAxis` axisCBG;
  347.     radioButtonGrp -e 
  348.         -sl (`optionVar -q showGrid` ? 1 : 2) gridRBG;
  349.     radioButtonGrp -e 
  350.         -sl (`optionVar -q activeObjectPivots` ? 1 : 2) activeObjectPivotsRBG;
  351.     radioButtonGrp -e 
  352.         -sl (`optionVar -q displayAffected` ? 1 : 2) affectedRBG;
  353.     radioButtonGrp -e 
  354.         -sl (`optionVar -q displayRegionOfEffect` ? 1 : 2) regionOfEffectRBG;
  355.     radioButtonGrp -e 
  356.         -sl `optionVar -q wireframeOnShadedActive` wireframeOnShadedActiveRBG;
  357.     radioButtonGrp -e 
  358.         -sl (`optionVar -q shadeTemplates` ? 1 : 2) shadeTemplatesRBG;
  359. }
  360.  
  361. global proc prefsUpdateKin() 
  362. {
  363.     global string $gPreferenceWindow;
  364.     setParent $gPreferenceWindow;
  365.     string $parent = "prefKinCol";
  366.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  367.  
  368.     floatSliderGrp -e 
  369.         -v (`optionVar -q ikJointDisplayScale`) jdsPrefWidget;
  370.     floatSliderGrp -e 
  371.         -v (`optionVar -q ikIkFkJointDisplayScale`) jdsIkFkPrefWidget;
  372.     floatSliderGrp -e 
  373.         -v (`optionVar -q ikHandleDisplayScale`) hdsPrefWidget;
  374.  
  375.     int $dm = 4;
  376.     string $display = `optionVar -q ikIkFkDisplayMethod`;
  377.     if ($display == "none") $dm = 1;
  378.     else if ($display == "ik") $dm = 2;
  379.     else if ($display == "fk") $dm = 3;
  380.     radioButtonGrp -edit -select $dm ikfkDisplay;
  381.     
  382. }
  383.  
  384. global proc prefsUpdateAnimDisplay() 
  385. {
  386.     global string $gPreferenceWindow;
  387.     setParent $gPreferenceWindow;
  388.     string $parent = "prefAnimDispCol";
  389.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  390.  
  391.     intSliderGrp -e
  392.         -v (`optionVar -q ghostFramesBefore`) ghostFramesBeforeSlider;
  393.     intSliderGrp -e
  394.         -v (`optionVar -q ghostFramesAfter`) ghostFramesAfterSlider;
  395.     intSliderGrp -e
  396.         -v (`optionVar -q ghostFrameStep`) ghostFrameStepSlider;
  397. }
  398.  
  399. global proc prefsUpdateManips() 
  400. {
  401.     global string $gPreferenceWindow;
  402.     setParent $gPreferenceWindow;
  403.  
  404.     string $parent = "prefManipsCol";
  405.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  406.  
  407.     optionMenuGrp -edit
  408.         -select `optionVar -query defaultShowManipulator`
  409.         defaultManipOpts;
  410.  
  411.     floatSliderGrp -e -v `optionVar -q manipGlobalScale` manipScale;
  412.     floatSliderGrp -e -v `optionVar -q manipHandleSize` manipHS;
  413.     intSliderGrp -e -v `optionVar -q manipLineSize` manipLS;
  414.     floatSliderGrp -e -v `optionVar -q manipLinePickSize` manipLP;
  415.     floatSliderGrp -e -v `optionVar -q manipPreviousStateSize` manipPS;
  416. }
  417.  
  418.  
  419. global proc prefsUpdateNURBS() 
  420. {
  421.     global string $gPreferenceWindow;
  422.     setParent $gPreferenceWindow;
  423.     string $parent = "prefNURBSCol";
  424.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  425.  
  426.     int $hasSurfaces = `isTrue SurfaceUIExists`;
  427.  
  428.     checkBoxGrp -e 
  429.         -value1 `optionVar -query  newCurveDisplayEP`
  430.         -value2 `optionVar -query  newCurveDisplayHull`
  431.         -value3 `optionVar -query  newCurveDisplayCV`
  432.         controlCBG1;
  433.  
  434.     if ( $hasSurfaces ) {
  435.         checkBoxGrp -e 
  436.             -value1 `optionVar -query  newSurfaceDisplayEP`
  437.             -value2 `optionVar -query  newSurfaceDisplayHull`
  438.             controlNewSurface1;
  439.  
  440.         checkBoxGrp -e 
  441.             -value1 `optionVar -query  newSurfaceDisplayCV`
  442.             -value2 `optionVar -query  newSurfaceDisplayOrigin`
  443.             controlNewSurface2;
  444.  
  445.         intSliderGrp -e -v `optionVar -q newNurbsIsoparms` nurbsDivUV;
  446.         intSliderGrp -e -v `optionVar -q newNurbsPointsShaded` nurbsDivS;
  447.     }
  448.     intSliderGrp -e -v `optionVar -q newNurbsPointsWire` nurbsDivW;
  449.  
  450.     displaySmoothness -dc -du `optionVar -q newNurbsIsoparms`;
  451.     displaySmoothness -dc -pw `optionVar -q newNurbsPointsWire`;
  452.     displaySmoothness -dc -ps `optionVar -q newNurbsPointsShaded`;
  453. }
  454.  
  455. global proc prefsUpdatePolys() 
  456. {
  457.     global string $gPreferenceWindow;
  458.     setParent $gPreferenceWindow;
  459.     string $parent = "prefPolysCol";
  460.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  461.     if (!`isTrue "PolygonsExists"`) return;  
  462.     
  463.     checkBoxGrp -e 
  464.         -value1 `optionVar -query  newPolyVtxDisp`
  465.         -value2 `optionVar -query  newPolyVertexNormals`
  466.         -value3 `optionVar -query  newPolyVtxBackCull`
  467.         polyVertDispCheck;
  468.  
  469.     radioButtonGrp -e 
  470.         -sl (`optionVar -q newPolyEdgeDisp` + 1) polyEdgeDispRadio;
  471.  
  472.     checkBoxGrp -e 
  473.         -value1 `optionVar -query  newPolyBorderEdgeHilite`
  474.         -value2 `optionVar -query  newPolyBorderMapHilite`
  475.         polyBordEdgeHiliteDispCheck;
  476.  
  477.     floatSliderGrp -e
  478.         -v `optionVar -q newPolyBorderEdgeSize` polyBordEdgeSizeSlider;
  479.     polyOptions -np -sb `optionVar -q newPolyBorderEdgeSize`;
  480.  
  481.     checkBoxGrp -e 
  482.         -value1 `optionVar -query  newPolyFacetCentreDisp`
  483.         -value2 `optionVar -query  newPolyFacetNormalDisp`
  484.         polyFacetDispCheck1;
  485.  
  486.     checkBoxGrp -e 
  487.         -value1 `optionVar -query  newPolyFacetTrngleDisp`
  488.         -value2 `optionVar -query  newPolyFacetWarpDisp`
  489.         polyFacetDispCheck2;
  490.  
  491.     checkBoxGrp -e 
  492.         -value1 `optionVar -query  newPolyNumVertexDisp`
  493.         -value2 `optionVar -query  newPolyNumEdgeDisp`
  494.         polyItemDispCheck1;
  495.  
  496.     checkBoxGrp -e 
  497.         -value1 `optionVar -query  newPolyNumFacetDisp`
  498.         -value2 `optionVar -query  newPolyNumUvDisp`
  499.         polyItemDispCheck2;
  500.  
  501.     floatSliderGrp -e 
  502.         -v `optionVar -q newPolyNormalSize` polyNormalSizeSlider;
  503.     polyOptions -np -sn `optionVar -q newPolyNormalSize`;
  504.  
  505.     optionMenuGrp -e
  506.         -sl (`optionVar -q newPolyBackFaceCull` + 1) polyFBackCullPopup;
  507.  
  508.     checkBoxGrp -e
  509.          -value1 `optionVar -query newPolyColorShaded` colorShadedDisplayCheck;
  510.     optionMenuGrp -e -sl
  511.         `optionVar -q newPolyColorChannel` colorMaterialPopup;
  512.  
  513.     prefPolyUpdateCulling();
  514. }
  515.  
  516. global proc prefsUpdateSettings() 
  517. {
  518.     global string $gPreferenceWindow;
  519.     setParent $gPreferenceWindow;
  520.     string $parent = "prefSettingsCol";
  521.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  522.  
  523.     string $type;
  524.     int $which;
  525.  
  526.     //  coordinate system
  527.     //
  528.     radioButtonGrp -e 
  529.         -sl ((`optionVar -q upAxisDirection` == "y") ? 1 : 2) 
  530.         upAxisRBG;
  531.  
  532.     //  linear units
  533.     //
  534.     $type = `optionVar -q workingUnitLinear`;
  535.     if ("mm" == $type || "millimeter" == $type) {
  536.         $which = 1;
  537.     } else if ("cm" == $type || "centimeter" == $type) {
  538.         $which = 2;
  539.     } else if ("m" == $type || "meter" == $type) {
  540.         $which = 3;
  541. // re-number next menus after removing this one
  542. //    } else if ("km" == $type || "kilometer" == $type) {
  543. //        $which = 4;
  544.     } else if ("in" == $type || "inch" == $type) {
  545.         $which = 4;
  546.     } else if ("ft" == $type || "foot" == $type) {
  547.         $which = 5;
  548.     } else if ("yd" == $type || "yard" == $type) {
  549.         $which = 6;
  550. //    } else if ("mi" == $type || "mile" == $type) {
  551. //        $which = 8;
  552.     } else {
  553.         $which = 1;
  554.     }
  555.     optionMenuGrp -e -sl $which linearOpts;
  556.  
  557.     //  angular
  558.     //
  559.     $type = `optionVar -q workingUnitAngular`;
  560.     if ("deg" == $type || "degree" == $type) {
  561.         $which = 1;
  562.     } else if ("rad" == $type || "radian" == $type) {
  563.         $which = 2;
  564.     } else {
  565.         $which = 1;
  566.     }
  567.     optionMenuGrp -e -sl $which angularOpts;
  568.  
  569.     //  time
  570.     //
  571.     $type = `optionVar -q workingUnitTime`;
  572.     if ("game" == $type) {
  573.         $which = 1;
  574.     } else if ("film" == $type) {
  575.         $which = 2;
  576.     } else if ("pal" == $type) {
  577.         $which = 3;
  578.     } else if ("ntsc" == $type) {
  579.         $which = 4;
  580.     } else if ("show" == $type) {
  581.         $which = 5;
  582.     } else if ("palf" == $type) {
  583.         $which = 6;
  584.     } else if ("ntscf" == $type) {
  585.         $which = 7;
  586.     } else if ("millisec" == $type) {
  587.         $which = 8;
  588.     } else if ("sec" == $type) {
  589.         $which = 9;
  590.     } else if ("min" == $type) {
  591.         $which = 10;
  592.     } else if ("hour" == $type) {
  593.         $which = 11;
  594.     } else {
  595.         $which = 1;
  596.     }
  597.     optionMenuGrp -e -sl $which timeOpts;
  598.     
  599.     // tolerance
  600.     //
  601.     floatSliderGrp -e 
  602.         -v `optionVar -q positionalTolerance` posTolFloatSliderGrp;
  603.     floatSliderGrp -e 
  604.         -v `optionVar -q tangentialTolerance` tanTolFloatSliderGrp;
  605. }
  606.  
  607.  
  608. global proc prefsUpdateAnim() 
  609. {
  610.     global string $gPreferenceWindow;
  611.     global string $gPlayBackSlider;
  612.  
  613.     setParent $gPreferenceWindow;
  614.     string $parent = "prefAnimCol";
  615.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  616.  
  617.     int    $which;
  618.     int    $size;
  619.     string $type;
  620.  
  621.     // Playback Start/End 
  622.     //
  623.     floatFieldGrp -e
  624.         -value1 `optionVar -query playbackMin`
  625.         -value2 `optionVar -query playbackMax`
  626.         timeSliderBounds;
  627.  
  628.     // Animation Start/End
  629.     // 
  630.     floatFieldGrp -e
  631.         -value1 `optionVar -query playbackMinRange`
  632.         -value2 `optionVar -query playbackMaxRange`
  633.         rangeSliderBounds;
  634.  
  635.     // Height
  636.     //
  637.     $size = `optionVar -q timeSliderHeight`;
  638.     $which = ($size < 30) ? 1 : (($size < 60) ? 2 : 3);
  639.     radioButtonGrp -e -sl $which timeLineSize;
  640.  
  641.     // Key Ticks
  642.     //
  643.     $type = `optionVar -q timeSliderShowKeys`;
  644.     if( $type == "active" ) {
  645.         radioButtonGrp -e -sl 2 showTicks;
  646.     } else if( $type == "none" ) {
  647.         radioButtonGrp -e -sl 1 showTicks;
  648.     } else {
  649.         radioButtonGrp -e -sl 3 showTicks;            
  650.     }
  651.  
  652.     // Options: Timecode, Snapping
  653.     //  
  654.     checkBoxGrp -e 
  655.         -value1 `optionVar -query timeSliderTimeCode`
  656.         -value2 `optionVar -query timeSliderSnapping`
  657.         timeLine;
  658.  
  659.     // Timecode Offset
  660.     //
  661.     textFieldGrp -e 
  662.         -enable `optionVar -q timeSliderTimeCode`
  663.         -text `optionVar -q timeSliderTimeCodeOffset` 
  664.         timeCodeOffset;
  665.  
  666.     // Update View
  667.     //
  668.     radioButtonGrp -e 
  669.         -sl (("active" == `optionVar -q timeSliderPlayView`) ? 1 : 2)
  670.         playbackView;
  671.  
  672.     // Looping
  673.     //
  674.     $type = `optionVar -q timeSliderPlayLoop`;
  675.     $which = ($type == "once") ? 1 : (($type == "oscillate") ? 2 : 3);
  676.     radioButtonGrp -e -sl $which playbackLooping;
  677.  
  678.     // Playback Speed
  679.     //
  680.     float $speed = `optionVar -query timeSliderPlaySpeed`;
  681.     if ($speed == 1.0) {
  682.         $which = 2;
  683.     } else if ($speed == 0.5) {
  684.         $which = 3;
  685.     } else if ($speed == 2.0) {
  686.         $which = 4;
  687.     } else if ($speed == 0.0) {
  688.         $which = 1;
  689.     } else {
  690.         $which = 5;
  691.     }
  692.  
  693.     optionMenu -e -sl $which speedOpts;
  694.     text -edit -enable ($which == 5) playbackSpeedT;
  695.  
  696.     floatField -edit
  697.         -enable ($which == 5)
  698.         -value $speed
  699.         playbackSpeedFF;
  700.  
  701.     // Playback By: value only applicable if the speed is
  702.     // "free" ($which == 1)
  703.     //
  704.     floatField -e -v `optionVar -q timeSliderPlayBy` playbackByFF;
  705.     rowLayout -edit -enable ($which == 1) playbackByRow;
  706. }
  707.  
  708. global proc prefsUpdateDyn() 
  709. {
  710.     global string $gPreferenceWindow;
  711.     setParent $gPreferenceWindow;
  712.     string $parent = "prefDynCol";
  713.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  714.     if (!`isTrue "DynamicsExists"`) return;
  715.     
  716.     checkBoxGrp -e -v1 (`optionVar -q dynPrefAutoCreate`) 
  717.         dynAutoCreate;
  718.  
  719.     checkBoxGrp -e -v1 (`optionVar -q dynPrefRunupToCurrentTime`) 
  720.         dynRunupToCurrentTime;
  721.  
  722.     radioButtonGrp -e -select (`optionVar -q dynPrefRunupFrom`)
  723.         dynRunupFrom;
  724.  
  725.     checkBoxGrp -e -v1 (`optionVar -q dynPrefSaveRuntimeState`) 
  726.         dynSaveRuntimeState;
  727.  
  728.     // Enable the dynRunupFrom radioButtonoGrp only if
  729.     // dynRunupToCurrentTime is on.
  730.     //
  731.     int $state = `checkBoxGrp -q -v1 dynRunupToCurrentTime`;
  732.     radioButtonGrp -e -enable $state dynRunupFrom;
  733. }
  734.  
  735. global proc prefsUpdateKeys() 
  736. {
  737.     global string $gPreferenceWindow;
  738.     setParent $gPreferenceWindow;
  739.     string $parent = "prefKeysCol";
  740.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  741.  
  742.     // Auto Key
  743.     //
  744.     int $autoKeyVal = `optionVar -q autoKeyframeState`;
  745.     checkBoxGrp -e -v1 $autoKeyVal autoKey;
  746.     string $characterAutoKey = `optionVar -q autoKeyCharacterState`;
  747.     int    $which = 1;
  748.     if ($characterAutoKey == "all") {
  749.         $which = 2;    
  750.     }
  751.     optionMenuGrp -e -select $which -enable $autoKeyVal autoKeyCharacter;
  752.  
  753.     optionMenuGrp -edit
  754.         -select `optionVar -query rotationInterpolationDefault`
  755.         rotationInterpolationDefaultOptions;
  756.  
  757.     // Weighted Tangents
  758.     //
  759.     int $weighted = `optionVar -q weightedTangents`;
  760.     checkBoxGrp -e -v1 $weighted weightedTangents;
  761.  
  762.     // Default in tangent
  763.     //
  764.     string $tangentType = `optionVar -q inTangentType`;
  765.     $which = 1;
  766.     if ($tangentType == "spline") {
  767.         $which = 1;
  768.     } else if ($tangentType == "linear") {
  769.         $which = 2;
  770.     } else if ($tangentType == "clamped") {
  771.         $which = 3;
  772.     } else if ($tangentType == "flat") {
  773.         $which = 4;
  774.     } 
  775.     optionMenuGrp -edit -select $which inTangentType;
  776.  
  777.     // Default out tangent
  778.     //
  779.     $tangentType = `optionVar -q outTangentType`;
  780.     $which = 1;
  781.     if ($tangentType == "spline") {
  782.         $which = 1;
  783.     } else if ($tangentType == "linear") {
  784.         $which = 2;
  785.     } else if ($tangentType == "clamped") {
  786.         $which = 3;
  787.     } else if ($tangentType == "flat") {
  788.         $which = 4;
  789.     } else if ($tangentType == "step") {
  790.         $which = 5;
  791.     } 
  792.     optionMenuGrp -edit -select $which outTangentType;
  793. }
  794.  
  795. global proc prefsUpdateModeling() 
  796. {
  797.     global string $gPreferenceWindow;
  798.     setParent $gPreferenceWindow;
  799.     string $parent = "prefModelingCol";
  800.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  801.  
  802.     int $curType = `modelWithType -1`;
  803.     if ($curType == 0) {
  804.         radioButtonGrp -e -sl 1 modelWithType1;
  805.         radioButtonGrp -e -enable 0 modelWithType5;
  806.     } else if ($curType == 1) {
  807.         radioButtonGrp -e -sl 1 modelWithType2;
  808.         radioButtonGrp -e -enable 0 modelWithType5;
  809.     } else if ($curType == 3) {
  810.         radioButtonGrp -e -sl 1 modelWithType3;
  811.         radioButtonGrp -e -enable 0 modelWithType5;
  812.     } else if ($curType == 2) {
  813.         radioButtonGrp -e -sl 1 modelWithType4;
  814.         radioButtonGrp -e -enable 0 modelWithType5;
  815.     } else if ($curType == -1) {
  816.         radioButtonGrp -e -sl 1 -enable 1 modelWithType5;
  817.     }
  818.  
  819.     $curType = `modelWithToolsAll -1`;
  820.     if ($curType == 0) {
  821.         radioButtonGrp -e -sl 1 modelWithTools2;
  822.         radioButtonGrp -e -enable 0 modelWithTools3;
  823.     } else if ($curType == 1) {
  824.         radioButtonGrp -e -sl 1 modelWithTools1;
  825.         radioButtonGrp -e -enable 0 modelWithTools3;
  826.     } else if ($curType == -1) {
  827.         radioButtonGrp -e -sl 1 -enable 1 modelWithTools3;
  828.     }
  829. }
  830.  
  831. global proc prefsUpdateSelect() 
  832. {
  833.     global int $gCustomSelPriority[];
  834.     global string $gSelectPriorityMode;
  835.     global string $gPreferenceWindow;
  836.     setParent $gPreferenceWindow;
  837.     string $parent = "prefSelectCol";    
  838.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  839.  
  840.     checkBoxGrp -e 
  841.         -value1 `optionVar -query selectSingleMarquee`
  842.         -value2 `optionVar -query selectClickDrag`
  843.         modsCBG1;
  844.     checkBoxGrp -e 
  845.         -value1 `optionVar -query selectAffectsActive`
  846.         -value2 `optionVar -query popupMenuSelection`
  847.         modsCBG2;
  848.     checkBoxGrp -e 
  849.         -value1 `optionVar -query ignoreSelectionPriority`
  850.         -value2 `optionVar -query expandPopupList`
  851.         modsCBG3;
  852.  
  853.     intSliderGrp -e 
  854.         -v `optionVar -q clickBoxSize` 
  855.         clickBoxSizeS;
  856.  
  857.     if (`isTrue "PolygonsExists"`) {
  858.         radioButtonGrp -e 
  859.             -sl (`optionVar -q polyFaceSensitive` ? 2 : 1) 
  860.             polyFaceSensitiveRadio;
  861.     }
  862.  
  863.     $gSelectPriorityMode = `optionVar -q selectPrefPriorityMode`;
  864.  
  865.     if ("custom" == $gSelectPriorityMode) {
  866.         optionMenu -e -sl 1 presetOpts;
  867.         intFieldGrp -e -en true priorVal;
  868.     } else if ("animation" == $gSelectPriorityMode) {
  869.         optionMenu -e -sl 2 presetOpts;
  870.         intFieldGrp -e -en false priorVal;
  871.     } else if ("nurbs" == $gSelectPriorityMode) {
  872.         optionMenu -e -sl 3 presetOpts;
  873.         intFieldGrp -e -en false priorVal;
  874.     } else if ("rendering" == $gSelectPriorityMode) {
  875.         optionMenu -e -sl 4 presetOpts;
  876.         intFieldGrp -e -en false priorVal;
  877.     } else if ("dynamics" == $gSelectPriorityMode) {
  878.         optionMenu -e -sl 5 presetOpts;
  879.         intFieldGrp -e -en false priorVal;
  880.     }
  881.  
  882.     $gCustomSelPriority = `optionVar -q customSelectPriority`;
  883.     selPriority( $gSelectPriorityMode );
  884.  
  885.     textScrollList -e -da -sii 1 priorList;
  886.     prefSelectPriorListChanged;
  887. }
  888.  
  889. global proc prefsUpdateSnap() 
  890. {
  891.     global string $gPreferenceWindow;
  892.     setParent $gPreferenceWindow;
  893.     string $parent = "prefSnapCol";    
  894.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  895.  
  896.     checkBoxGrp -e
  897.         -value1 `optionVar -query useSnapTolerance`
  898.         useSnapCBG1;
  899.         
  900.     intSliderGrp -e 
  901.         -v `optionVar -q snapTolerance` 
  902.         snapToleranceSG;
  903.  
  904.     intSliderGrp -e 
  905.         -v `optionVar -q snapUVTolerance` 
  906.         snapUVToleranceSG;
  907.  
  908.     intSliderGrp -e
  909.         -v `optionVar -q snapMagnet`
  910.         snapMagnetSG;
  911.  
  912.     floatSliderGrp -e
  913.         -v `optionVar -q snapMagnetTolerance`
  914.         snapMagnetToleranceSG;
  915. }
  916.  
  917. global proc prefsUpdateSound() 
  918. {
  919.     global string $gPreferenceWindow;
  920.     setParent $gPreferenceWindow;
  921.     string $parent = "prefSoundCol";
  922.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  923.  
  924.     // Waveform display
  925.     //
  926.     string $waveform = `optionVar -q timeSliderSoundDisplay` ;
  927.     if( $waveform == "bottom" ) {
  928.         radioButtonGrp -e -sl 2 soundDisplay;
  929.     } else if( $waveform == "both" ) {
  930.         radioButtonGrp -e -sl 3 soundDisplay;
  931.     } else {
  932.         radioButtonGrp -e -sl 1 soundDisplay;
  933.     }
  934.  
  935.     // Repeat on Hold
  936.     //
  937.     int $doRepeat = `optionVar -q timeSliderRepeatOnHold` ;
  938.     checkBoxGrp -e -v1 $doRepeat soundRepeat;
  939.  
  940.     // Repeat Size
  941.     //
  942.     float $chunk = `optionVar -q timeSliderRepeatChunk`;
  943.     int   $canDisplayChunk = ( $chunk == 1.0 || $chunk == 2.0 || 
  944.                                $chunk == 3.0 );
  945.  
  946.     rowLayout -e -enable $doRepeat soundRepeatChunkLayout;
  947.     floatField -e -value $chunk soundRepeatChunkValue;
  948.  
  949.     if( $canDisplayChunk ) {
  950.         radioButton -e -sl ( "soundRepeatChunk" + int( $chunk ) );
  951.     } else {
  952.         radioButton -e -sl "soundRepeatChunk4";
  953.     }
  954. }
  955.  
  956. global proc prefsUpdateAdvanced() 
  957. {
  958.     global string $gPreferenceWindow;
  959.     setParent $gPreferenceWindow;
  960.     string $parent = "prefAdvancedCol";
  961.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  962.  
  963.     //  undo
  964.     int $isInfinite = `optionVar -q undoIsInfinite`;
  965.     radioButtonGrp -e 
  966.         -sl (`optionVar -q undoIsEnabled` == on ? 1 : 2) 
  967.         undoEnableRBG;
  968.     radioButtonGrp -e 
  969.         -sl ($isInfinite ? 1 : 2) 
  970.         queueLimitRBG;
  971.     intFieldGrp -e 
  972.         -enable (!$isInfinite) 
  973.         -value1 `optionVar -query undoLength` 
  974.         queueSizeIFG;
  975. }    
  976.  
  977. // Description: Update the rendering pref UI to reflect
  978. //                the current status of the option variables
  979. // Returns:        None
  980. //
  981. global proc prefsUpdateRendering() 
  982. {
  983.     global string $gPreferenceWindow;
  984.     setParent $gPreferenceWindow;
  985.     string $parent = "prefRenderingCol";
  986.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  987.  
  988.     string $prefRen = "mayaSoftware";
  989.  
  990.     if (`optionVar -exists preferredRenderer`)
  991.     {
  992.         $prefRen = `optionVar -q preferredRenderer`;
  993.     }
  994.  
  995.     if (!`renderer -exists $prefRen`)
  996.     {
  997.         $prefRen = "mayaSoftware";
  998.     }
  999.     
  1000.     // Update the Renderer selection option box to reflect current renderer
  1001.     //
  1002.     string $renderers[] = `renderer -query -namesOfAvailableRenderers`; 
  1003.  
  1004.     for ($i = 0; $i < size($renderers); $i += 1)
  1005.     {
  1006.         if($renderers[$i] == $prefRen)
  1007.         {
  1008.             optionMenu -edit -select ($i+1) prefRendererOptionMenu;
  1009.         }
  1010.     }
  1011. }    
  1012.  
  1013. global proc prefsUpdateFileIO() 
  1014. {
  1015.     global string $gPreferenceWindow;
  1016.     setParent $gPreferenceWindow;
  1017.     string $parent = "prefFileIOCol";
  1018.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  1019.  
  1020.     // If MAYA_PROJECTS_DIR env var is set, we won't allow
  1021.     // this to be set from the UI
  1022.     string $envVar = `getenv MAYA_PROJECTS_DIR`;
  1023.     if ( size($envVar) > 0 )
  1024.     {
  1025.         textField -e -ed false -tx $envVar projectsDir;
  1026.         button -e -en false projectsDirBrowser;
  1027.     }
  1028.     else
  1029.     {
  1030.         if ( `optionVar -ex ProjectsDir` )
  1031.         {
  1032.             textField -e -tx `optionVar -q ProjectsDir` projectsDir;
  1033.         }
  1034.     }
  1035.  
  1036.     // Same for MAYA_PROJECT
  1037.     string $envVar = `getenv MAYA_PROJECT`;
  1038.     if ( size($envVar) > 0 )
  1039.     {
  1040.         textField -e -ed false -tx $envVar initialProject;
  1041.         button -e -en false initialProjectBrowser;
  1042.     }
  1043.     else
  1044.     {
  1045.         if ( `optionVar -ex InitialProject` )
  1046.         {
  1047.             textField -e -tx `optionVar -q InitialProject` initialProject;
  1048.         }
  1049.     }
  1050.     
  1051.     //  recent files maximum history size
  1052.     intSliderGrp -e -v `optionVar -q RecentFilesMaxSize` RecentFilesMaxSize;
  1053.  
  1054.     //  recent backups maximum history size
  1055.     intSliderGrp -e -v `optionVar -q RecentBackupsMaxSize` RecentBackupsMaxSize;
  1056.  
  1057.     //  recent projects maximum history size
  1058.     intSliderGrp -e -v `optionVar -q RecentProjectsMaxSize` RecentProjectsMaxSize;
  1059.     
  1060.     //  file save compression
  1061.     string $mode = `optionVar -q fileCompressionMode`;
  1062.     if ("compressed" == $mode) {
  1063.         radioButtonGrp -e -sl 1 compressionRBG;
  1064.     } else if ("uncompressed" == $mode) {
  1065.         radioButtonGrp -e -sl 2 compressionRBG;
  1066.     } else {
  1067.         radioButtonGrp -e -sl 3 compressionRBG;
  1068.     }
  1069.  
  1070.     // Display Layers
  1071.     radioButtonGrp -e
  1072.         -sl (`optionVar -q displayLayerMerge` + 1)
  1073.         layerMerge;
  1074. }
  1075.  
  1076. global proc prefsUpdateModules() 
  1077. {
  1078.     global string $gPreferenceWindow;
  1079.     setParent $gPreferenceWindow;
  1080.     string $parent = "prefModulesCol";
  1081.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  1082.  
  1083.     checkBoxGrp -e
  1084.         -value1 `optionVar -query loadDynamics`
  1085.         packCBG1;
  1086.  
  1087.     checkBoxGrp -e
  1088.         -value1 `optionVar -query loadUrchin`
  1089.         packCBG8;
  1090. }
  1091.  
  1092. global proc prefsUpdateOpenMaya() 
  1093. {
  1094.     global string $gPreferenceWindow;
  1095.     setParent $gPreferenceWindow;
  1096.     string $parent = "prefOpenMayaCol";
  1097.  
  1098.     // openMaya prefs are not available on NT
  1099.     if (`about -nt`) return;
  1100.  
  1101.     if (`columnLayout -q -numberOfChildren $parent` == 0) return;
  1102.  
  1103.     radioButtonGrp -e 
  1104.         -sl (`optionVar -q apiPrefLazyLoading` ? 1 : 2) 
  1105.         lazyLoadingCheck;
  1106.  
  1107.     radioButtonGrp -e 
  1108.         -sl (`optionVar -q apiPrefOldPluginWarning` ? 1 : 2) 
  1109.         oldPluginWarningCheck;
  1110. }
  1111.